<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <head>
	 <base href="<%=basePath%>">
		<meta charset="utf-8" />
		<title>校园招聘</title>
		<link rel="stylesheet" href="css/bootstrap.min.css">
		<link href="css/content.css" rel="stylesheet">
		<link  href="css/footer.css" rel="stylesheet">
		<script type="text/javascript" src="js/jquery-1.10.2.js"></script>
		<script type="text/javascript" src="js/bootstrap.min.js"></script>
	</head>
  
  <body>
  <!-- 导入导航栏 -->
		<jsp:include page="/common/header.jsp"></jsp:include>
			<!-- 分割 -->
		<div style="height: 20px;"></div>
   <div class="container">
	<div class="row">
			<table class="table table-hover">
				<thead>
					<tr>
						<th style="width:100px;">
							职位名称
						</th>
						<th >
							职位要求
						</th>
						<th style="width:100px;">
							职位地点
						</th>
						<th style="width:100px;">
							薪水
						</th>
						<th style="width:100px;">
							公司标识ID
						</th>
						<th style="width:100px;">
							发布日期
						</th>
						<c:if test="${user!=null }" var="flag" scope="session">
						<c:if test="${user.status==0 }" var="flag" scope="session">
						<th>
							投简历
						</th>
						</c:if>
						</c:if>
					</tr>
				</thead>
				<c:forEach items="${ positions}"  var="position">
					<tr>
						<td>
							${position.name }
						</td>
						<td>
							${ position.tip}
						</td>
						<td>
							${ position.location}
						</td>
						<td>
							${ position.salary}
						</td>
						<td>
							<a href="show/showcompany?id=${ position.cId}">${ position.cId}</a>
						</td>
						<td>
							<fmt:formatDate pattern="yyyy-MM-dd" value="${ position.pubtime}" />
						</td>
						<td>
							<input type="button" value="删除" onclick="del(${ position.id})">
						</td>
					</tr>
				</c:forEach>
				
			</table>
		 <a href="show/showmyposition?cId=${user.id}&pageNO=${pageNO-1 }" <c:if test="${pageNO<=1 }">  onclick="javascript:return false;" </c:if> >上一页</a>
		<c:forEach var="i" begin="1" end="${count%size==0?count/size:count/size+1}">
		<input class="btn btn-default btn-sm" type="button" onclick="return tiaozhuan('${i}')" value="${i}"> 
		<!--<span class="current"> </span> -->
		<!-- <a href="showuser.do?pageNumber=${i}&pageSize=${PageInfo.pageSize}"><c:out value="${i}"/></a> -->
		</c:forEach>
		<a href="show/showmyposition?cId=${user.id}&pageNO=${pageNO+1 }" <c:if test="${pageNO>=count/size }">  onclick="javascript:return false;" </c:if> >下一页</a>
		<script type="text/javascript">
			function tiaozhuan(i) {
				location.href = "show/showmyposition?cId=${user.id}&pageNO="+i+"&pageSize=${size}";
				
			}
		</script>			
	</div>
</div>
  <!--分页 -->
        <link href="css/pagination.css" type="text/css" rel="stylesheet" />
        <script type="text/javascript" src="js/jquery.pagination.js"/></script>
        <script type="text/javascript">
           //初始化分页组件
           var count=${count};
           var size=${size};
           var pageNO=${pageNO};
           var a;
           $("#pager").pagination(count, {
              items_per_page:size,
               current_page:pageNO-1,
               next_text:"下一页",
               prev_text:"上一页",
               num_edge_entries:2,
               load_first_page:false,
               callback:handlePaginationClick
            });
           
           //回调方法
           function handlePaginationClick(new_page_index, pagination_container){
      			location.href="show/showmyposition?pageNO="+(new_page_index+1);
           }
           
           
           function del(a){
           	$.post("do/delposition", { zId: a}, function(data){
       		   alert(data);
       		   location.reload(true) ;
        	  });
           
           
           }
           
           
      
        </script>
	

<!-- 导入底部信息 -->
  	<jsp:include page="/common/footer.jsp"></jsp:include>

  </body>
</html>
